import { InfoCircleOutlined } from "@ant-design/icons";
import { Tag, Tooltip } from "antd";
const valueEnum = {
  0: { text: "未发送", status: "processing" },
  1: { text: "已发送", status: "processing" },
  2: { text: "发送失败", status: "error" },
};
export const namespace = "contentPush";

export const calcColumns = (params) => {
  const columns = [
    {
      title: "通知类型",
      dataIndex: "templateName",
    },
    {
      title: "会员昵称",
      dataIndex: "wechatUserName",
    },
    {
      title: "手机号码",
      dataIndex: "wechatUserTel",
    },
    // {
    //   dataIndex: "venueName",
    //   title: "所属场馆",
    // },
    {
      title: "课程名称",
      dataIndex: "scheduleName",
      hideInSearch: true,
      ellipsis: true,
    },
    {
      title: "推送时间",
      dataIndex: "sendTime",
      hideInSearch: true,
    },

    {
      title: "推送状态",
      dataIndex: "sendStatus",
      render: (_, records) => {
        return (
          <Tooltip placement="top" title={records.sendFailReason}>
            <Tag bordered={false} color={valueEnum[records.sendStatus].status}>
              {valueEnum[records.sendStatus].text}
              {records.sendStatus == 2 && (
                <InfoCircleOutlined style={{ marginLeft: "10px" }} />
              )}
            </Tag>
          </Tooltip>
        );
      },
    },
  ];
  if (params?.operate) {
    columns.push(params?.operate);
  }
  return columns;
};
